#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/10/23 23:06
# @Author  : when
# @File    : page_boss_job.py
# @Description : page 和 boss_job关联表

from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, ForeignKey

from crawler.orm_model.base_model import Base
from crawler.orm_model.base_model import BaseModel


class PageBossJob(Base, BaseModel):
    """
    关联表： page 和 boss_job
    """
    __tablename__ = 'page_boss_job'

    id = Column(Integer, primary_key=True, autoincrement=True)
    page_id = Column(Integer, ForeignKey(f"page.id"), nullable=False)
    boss_job_id = Column(Integer, ForeignKey(f"boss_job.id"), nullable=False)
    page = relationship("Page", back_populates="page_boss_job")
    boss_job = relationship("BossJob", back_populates="page_boss_job")
